package com.aaa.system.Controller;

import com.aaa.entity.User;
import com.aaa.system.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/system/user")
public class UserController {

    @Autowired
    private UserService userService;

    /**
     * 远程调用 通过手机号查询用户信息
     */
    @GetMapping("getByUsername/{username}")
    public User getByUsername(@PathVariable String username) {
        return userService.findByUsername(username);
    }
    /**
     * 远程调用 查询用户所有的信息
     */
    @GetMapping("getAllUserList")
    public List<User> getAllUserList(){
        return userService.getAllUserList();
    }
    /**
     * 远程调用 查询用户是否需要排班
     */
    @PostMapping("queryUserNeedScheduling")
    public List<User> queryUserNeedScheduling(@RequestBody Map<String,Object> map){
        return userService.queryUserNeedScheduling(map);
    }

    /**
     * 远程调用 根据userID查询接诊医生
     * @param userId
     * @return
     */
    @PostMapping("getUsernameById/{userId}")
    public String getUsernameById(@PathVariable Long userId){
        return userService.getUsernameById(userId);
    }
}
